<?php
/**
 * licenses : MIT
 * creatTime: 2020/5/13
 * author : weblinuxgame
 * filename: UserApi.php
 */

namespace App\Api\Modules\User\Admin;

use Illuminate\Http\Response;
use OpenApi\Annotations as OA;
use Laravel\Lumen\Http\Request;
use Illuminate\Http\RedirectResponse;

/**
 * @OA\Tag(
 *     name="AdminAuth",
 *     description="## 管理后台-认证接口集合"
 * )
 *
 * Interface AuthApi
 * @package App\Api\Modules\User
 */
interface AuthApi
{
    /**
     * @OA\Post(
     *     path="/admin/login",
     *     tags={"AdminAuth"},
     *     summary="admin user login",
     *     description="仅用于后台管理员登陆",
     *     operationId="adminLogin",
     *     @OA\RequestBody(
     *       description="用户登陆请求",
     *       @OA\JsonContent(ref="#/components/schemas/UserLoginRequest"),
     *     ),
     *     @OA\Response(
     *         response="default",
     *         description="successful operation",
     *         @OA\JsonContent(ref="#/components/schemas/LoginSuccessResponse")
     *     ),
     * )
     */

    /**
     * 用户登陆接口
     * @param Request $request
     * @return Response
     */
    public function login(Request $request): Response;

    /**
     * @OA\Delete(
     *     path="/admin/logout",
     *     tags={"AdminAuth"},
     *     summary="admin user logout",
     *     description="仅用于后台管理员退登",
     *     operationId="adminLogout",
     *      @OA\Parameter(
     *          name="Authentication",
     *          in="header",
     *          description="退出登陆,仅需要身份临牌",
     *          @OA\Schema(
     *              type="string",
     *              format="string",
     *              example="94a08da1fecbb6e8b46990538c7b50b2"
     *          )
     *      ),
     *     @OA\Response(
     *         response="default",
     *         description="请求结果",
     *        @OA\JsonContent(
     *           type="object",
     *           @OA\Items(ref="#/components/schemas/ApiResponse"),
     *           examples={
     *              "退出成功":{  "value": {"code":200,"message":"ok","data":null } },
     *              "退出失败":{  "value": {"code":0,"message":"failed","data":null} },
     *           }
     *       ),
     *     ),
     *  )
     */
    /**
     * 退出
     * @param Request $request
     * @return Response
     */
    public function logout(Request $request): Response;


    /**
     * @OA\Delete(
     *     path="/admin/signOut",
     *     tags={"AdminAuth"},
     *     summary="admin user logout",
     *     description="仅用于后台管理员退登,并强制跳转(默认回到登陆页)",
     *     operationId="adminSignOut",
     *      @OA\Parameter(
     *          name="Authentication",
     *          in="header",
     *          description="退出登陆,仅需要身份临牌",
     *          @OA\Schema(
     *              type="string",
     *              format="string",
     *              example="94a08da1fecbb6e8b46990538c7b50b2"
     *          )
     *      ),
     *     @OA\Response(
     *         response="default",
     *         description="强制跳转回登陆页",
     *     ),
     *  )
     */
    /**
     * 退出并强制跳转到非登陆状态逻辑页面
     * @param Request $request
     * @return RedirectResponse
     */
    public function signOut(Request $request): RedirectResponse;

    /**
     * @OA\Post(
     *     path="/admin/signIn",
     *     tags={"AdminAuth"},
     *     summary="admin user signIn",
     *     description="仅用于后台管理员登陆,成功自动跳转到默认首页",
     *     operationId="adminSignIn",
     *     @OA\RequestBody(
     *       description="用户登陆请求",
     *      required=true,
     *      @OA\MediaType(
     *        mediaType="multipart/form-data",
     *        @OA\Schema(
     *           ref="#/components/schemas/UserLoginRequest"
     *         )
     *      )
     *     ),
     *     @OA\Response(
     *         response="default",
     *         description="用户登陆成功并跳转到后台首页",
     *     ),
     * )
     */

    /**
     * 用户登陆成功并跳转到后台首页
     * @param Request $request
     * @return RedirectResponse
     */
    public function signIn(Request $request): RedirectResponse;

}
